package com.hg.onlineshop.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hg.onlineshop.entity.Category;
import com.hg.onlineshop.mapper.CategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/category")
public class CategoryController {

    @Autowired
    private CategoryMapper categoryMapper;

    @GetMapping("/all")
    public List<Category> findAllCategory() {
        List<Category> categories = categoryMapper.selectList(Wrappers.<Category>lambdaQuery().eq(Category::getDelStatus, "0"));
        return categories;
    }

}
